package com.atguigu.service.Impl;

import com.atguigu.mapper.EmployeeMapper;
import com.atguigu.pojo.Employee;
import com.atguigu.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: liuaojun
 * @CreateTime: 2025-02-07
 * @Description:
 * @Version: 1.0
 */
@Slf4j
@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Employee getEmployeeById(Integer eid) {
        Employee employeeById = employeeMapper.getEmployeeById(eid);
        log.info("employeeById = " + employeeById);
        return employeeById;
    }

    @Override
    public List<Employee> getAllEmployee() {
        List<Employee> allEmp = employeeMapper.getAllEmp();
        log.info("allEmp = " + allEmp);
        return allEmp;
    }

    @Override
    public void addEmployee(Employee employee) {
        employeeMapper.insertEmp(employee);
    }

    @Override
    public void updateEmployee(Employee employee) {
        employeeMapper.updateEmp(employee);
    }

    @Override
    public void deleteEmployee(Integer id) {
        employeeMapper.deleteEmp(id);
    }
}
